﻿@using CoralNode.Core.Entity.Domains.Site
@using CoralNode.Core.Entity.Enums
@using CoralNode.MvcClient.Helper
@using Coralcode.Base.Entity
@using Coralcode.Base.Utils
@model CoralNode.Core.Entity.SearchQuerys.Site.MenuSearchQuery

@{
    ViewBag.Title = "Index";
}

@Html.IncludePage("CoralAdmin/prototype", "_Left", new { current = "menu" })
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">菜单设计&nbsp;&nbsp;/&nbsp;&nbsp;菜单管理</span>
        </div>
        <div id="main">
            <div class="content_tab extra_normal">
                <div class="tablist extra_normal">
                </div>
            </div>
            <div class="js_tabcnt">
                <div class="tablelist_style1" data-js="tabellist_style1">
                    <div class="funsearch p_1 pl_2 pr_2 extra_normal">
                        <div class="select_owner w_12-5 " data-meta="{value:'@ViewBag.Group.Id', btn:'<span class=\'ico ico_slide_down\'></span>' , clickbtn:'<span class=\'ico ico_slide_up\'></span>'}">
                            <ul>
                                @foreach (var item in @ViewBag.MenuGroupList) {
                                    if (@item.Id == @ViewBag.Group.Id) {
                                    <li data-value="@item.Id"><a class="current" href="/m/menu/listMenu?GroupId=@item.Id">@item.Title</a>
                                    </li>
                                    } else {
                                    <li data-value="@item.Id"><a href="/m/menu/listMenu?GroupId=@item.Id">@item.Title</a>
                                    </li>
                                    }
                                }
                            </ul>
                        </div>
                        <a class="btn_5 f_r ml_3" href="/m/menu/createMenu?groupId=@ViewBag.Group.Id">添加菜单</a>
                        <div class="f_r">
                            <form method="POST" action="/m/menu/listMenu">
                                <span class="t_des f_l pt_0-5">菜单名称：</span>
                                <label class="search f_l">
                                    @Html.TextBoxFor(m => m.Title, new { @class = "text w_18", @msg = "请输入关键字" })
                                    @Html.AntiForgeryToken()
                                    <input type="submit" value="" class="submit" /></label>
                            </form>
                        </div>
                    </div>
                    <table cellpadding="0" cellspacing="0">
                        <tr class="exclude">
                            <th width="60">选择</th>
                            <th width="50" align="left">ID</th>
                            <th align="left">名称</th>
                            <th align="left">路径</th>
                            <th width="80">排序</th>
                            <th width="60">状态</th>
                            <th width="140">操作</th>
                        </tr>
                        @foreach (MenuDomain item in ViewBag.MenuList) {
                            <tr data-parentId="@item.ParentId" data-depth="@item.Depth">
                                <td>
                                    <label class="checkbox_own">
                                        <input type="checkbox" value="@item.Id"/></label></td>
                                <td class="td_left">@item.Id</td>
                                <td class="td_left">
                                    @if (@item.ParentId > 0) {
                                        <span class="ico ico_child ml_@(item.Depth - 1)"></span><a href="/m/menu/editMenu/@item.Id?groupId=@item.Group.Id">@item.Title</a>
                                    } else {
                                        <a href="/m/menu/editMenu/@item.Id?groupId=@item.Group.Id">@item.Title</a>
                                    }
                                </td>
                                <td class="td_left">@item.Path</td>
                                <td><a href="/m/menu/ChangeRank/@item.Id" class="ico ico_moveup mr_2 f_no  btn"></a>
                                    <a href="/m/menu/ChangeRank/@item.Id" class="ico ico_movedown btn"></a>
                                </td>
                                <td><a href="/m/menu/ChangeMenuStatus/@item.Id" class="ico ico_eye_@item.IsValid js_changestate btn">
                                </a></td>
                                <td>
                                    <div class="fun">
                                        <a href="/@CoralNode.MvcClient.Contexts.CoralNodeContext.Current.Workbench.Hosts/@item.Path" target="_blank">
                                            预览</a> <a href="/m/menu/editMenu/@item.Id?groupId=@item.Group.Id">编辑</a><a href="/m/menu/deleteMenu/@item.Id" class="js_delete">删除</a>
                                    </div>
                                </td>
                            </tr>
                        }
                    </table>
                    <div class="global_fun ">
                        <label class="checkbox_own gloabal_select">
                            <input type="checkbox" /></label>
                        <input type="button" class="btn_4 btn invert" value="反选" /><input type="button" class="btn_4 btn reset"
                            value="重置" />
                        <a href="#" class="js_delete">删除</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>